package com.heima.controller;

import com.heima.pojo.dto.ChannelDto;
import com.heima.pojo.vo.ChannelVo;
import com.heima.service.ChannelService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Slf4j
@RequestMapping("/api/vm-service/channel")
public class ChannelController {

    @Autowired
    private ChannelService channelService;

    /**
     * 获取渠道信息
     * @param innerCode
     * @return
     */
    @GetMapping("/channelList/{innerCode}")
    public List<ChannelVo> channelInfo(@PathVariable String innerCode) {
        List<ChannelVo> channelVo = channelService.channelInfo(innerCode);
        return channelVo;
    }

    @PutMapping("/channelConfig")
    public Boolean channelConfig(@RequestBody ChannelDto channelDto) {
        return channelService.channelConfig(channelDto);
    }
}
